using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

namespace MVCMS.Util.Persistence
{
    public interface Repository<T>
    {
        /// <summary>
        /// Returns the entire data set in the repository
        /// </summary>
        /// <returns></returns>
        IEnumerable<T> GetAll();

        /// <summary>
        /// Returns a subset of the data, provided by paging
        /// </summary>
        /// <param name="start">1 based index to start at</param>
        /// <param name="count">How many records to return</param>
        /// <returns></returns>
        IEnumerable<T> Get(int start, int count);

        /// <summary>
        /// A open-ended search function; may want to rethink this one
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        IQueryable<T> Find(Expression<Func<T, bool>> expression);
        
        void Save(T item);
        
        void Remove(T item);
    }
}